package com.wang.honi.Callback;

import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCallback;
import android.bluetooth.BluetoothProfile;
import android.util.Log;

public class BleCallback extends BluetoothGattCallback {

    private static final String TAG = BleCallback.class.getSimpleName();

    @Override
    public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
        if(status == BluetoothGatt.GATT_SUCCESS){
            switch (newState){
                case BluetoothProfile.STATE_CONNECTED://连接成功
                    Log.d(TAG, "onConnectionStateChange: 连接成功");
                    break;
                case BluetoothProfile.STATE_DISCONNECTED://断开连接
                    Log.d(TAG, "onConnectionStateChange: 断开连接");    
            }
        }
        else {
            Log.e(TAG, "onConnectionStateChange: " + status);
        }
    }
}
